//package common.fengkai.filepost.utils;
//
//import com.alibaba.fastjson.JSONObject;
//import com.kinggrid.ws.PdfActionService;
//import org.apache.cxf.endpoint.Client;
//import org.apache.cxf.frontend.ClientProxy;
//import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
//import org.apache.cxf.transport.http.HTTPConduit;
//import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
//
//import java.nio.file.Files;
//import java.nio.file.Paths;
//import java.util.Objects;
//
///**
// * 测试电子签章接口
// */
//public class CheckPDFTwo {
//
//    public static byte[]  sign_SM(byte[] file,JSONObject jsonObject) throws Exception {
//        //String url = "http://10.0.100.57:7001/iSignatureWebPDF/services/PdfActionService";
//        //String url = "http://10.29.31.124:8002/eseal/iSignatureWebPDF/services/PdfInfoWebService";  网关 http://10.29.31.61:8882/eseal/eseal/app/services/signPdf
//        //String url = "http://10.29.31.58:8002/eseal/iSignatureWebPDF/services/PdfInfoWebService";
//        //String url = "http://10.29.31.121:8882/eseal/eseal/iSignatureWebPDF/services/PdfInfoWebService";
//
//        //生产（http://10.30.48.249） uat（http://10.29.28.3）
//        String url = "http://10.30.48.249/eseal/eseal/iSignatureWebPDF/services/PdfInfoWebService";
//        JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();
//        factoryBean.setServiceClass(PdfActionService.class);
//        factoryBean.setAddress(url);
//        PdfActionService pdfActionService = (PdfActionService) factoryBean.create();
//
//        Client proxy = ClientProxy.getClient(pdfActionService);
//        HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
//        conduit.getClient().setReceiveTimeout(0L);
//        HTTPClientPolicy policy = new HTTPClientPolicy();
//        policy.setConnectionTimeout(60000L);
//        policy.setAllowChunking(false);
//        policy.setReceiveTimeout(120000L);
//        conduit.setClient(policy);
//        String jsonString = jsonObject.toJSONString();
//        System.out.println("jsonString==="+jsonString);
//        if (!Objects.equals("com.ctc.wstx.stax.WstxInputFactory", System.getProperty("javax.xml.stream.XMLInputFactory"))) {
//            System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory");
//            System.setProperty("javax.xml.stream.XMLOutputFactory", "com.ctc.wstx.stax.WstxOutputFactory");
//            System.setProperty("javax.xml.stream.XMLEventFactory", "com.ctc.wstx.stax.evt.WstxEventFactory");
//        }
//
//        byte[] result = pdfActionService.exec(file, jsonString, null);
//        System.out.println("result.length:"+result.length);
//        //太平财产保险有限公司青岛分公司中英文刘洪涛授权签名章
//        //太平财产保险有限公司青岛分公司中英文刘洪涛授权签名章
//        Files.write(Paths.get("C:\\Users\\carry\\Desktop\\项目资料\\66801060620200000006pdfsigned.pdf"), result);
//        //Files.write(Paths.get("D:/TestSignd签名.pdf"), result);
//        return  result;
//    }
//
//
//       public static void main(String[] args){
//
//
//          }
//
//
//}